package com.hwh.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.hwh.serviceIm.BuyersServiceImpl;
import com.hwh.vo.Buyers;

public class BuyerRegistController extends HttpServlet{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) 
	         throws ServletException, IOException {
       super.doPost(req, resp);
   }

	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		
		req.setCharacterEncoding("utf-8");
		// 获取前台form表单的input输入框
		String buy_name = req.getParameter("buy_name");
		String buy_pwd = req.getParameter("buy_pwd");
		int buy_phone = Integer.parseInt(req.getParameter("buy_phone"));
		Buyers buy = new Buyers(buy_name,buy_pwd,buy_phone);
		
		BuyersServiceImpl bsi = new BuyersServiceImpl();
		bsi.buyerRegist(buy);
		
		req.getRequestDispatcher("buylogin.jsp").forward(req, resp);
		
		
		
	}
	
	
	
}
